﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using BotvaBot.BusinessLayer.Configuration.Personaj;
using BotvaBot.BusinessLayer.Enums;

namespace BotvaBot.Configuration.Personaj
{
    public class PersonajCfg : CustomConfigElementBase
    {
        [ConfigurationProperty("Email")]
        public string Email
        {
            get { return (String)base["Email"]; }
        }

        [ConfigurationProperty("Password")]
        public string Password
        {
            get { return (String)base["Password"]; }
        }

        [ConfigurationProperty("Server")]
        public Int32 Server
        {
            get { return (Int32)base["Server"]; }
        }
        
        [ConfigurationProperty("HasLetun")]
        public Int32 HasLetun
        {
            get { return (Int32)base["HasLetun"]; }
        }

        [ConfigurationProperty("StateInfo")]
        public StateInfoCfg StateInfo
        {
            get { return (StateInfoCfg)base["StateInfo"]; }
        }

        [ConfigurationProperty("WarGildia")]
        public WarGildiaCfg WarGildia
        {
            get { return (WarGildiaCfg)base["WarGildia"]; }
        }

        [ConfigurationProperty("KulonSet")]
        public GenericConfigElementCollection<KulonCfg> KulonSet
        {
            get
            {
                return base["KulonSet"]
                    as GenericConfigElementCollection<KulonCfg>;
            }
        }

        public Dictionary<Kulon, int> KulonsLib
        {
            get
            {
                Dictionary<Kulon, int> result = new Dictionary<Kulon,int>();
                foreach (var kulonCfg in KulonSet.Items)
                {
                    result.Add(kulonCfg.Type, kulonCfg.ID);
                }
                return result;
            }
        }
    }
}
